package com.qfmy.app.mapper.community;

import com.qfmy.model.entity.community.Blog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.app.mapper.community
 * @date 2025/4/17
 * @description 博客
 */
@Mapper
@SuppressWarnings("all")
public interface BlogMapper {

    /**
     * 插入
     * @param blog
     */
    void insert(Blog blog);

    /**
     * 获取博客列表
     *
     * @param start
     * @param size
     * @return
     */
    List<Blog> getBlogList(int start, Integer size);

    /**
     * 更新阅读量
     * @param blogId
     */
    @Update("update blog set read_count = read_count + 1 where id = #{blogId}")
    void updateReadCount(Long blogId);
}
